<%@page import="java.sql.Timestamp"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.DateFormat"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
	SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM");
	
	String today = dft.format(new Date());
	//Date da=dft.parse(today);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>${headerTitle}</title>
	<base href="<%=basePath%>/" />

	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"; /><!-- IE的渲染模式 -->
    <meta name="renderer" content="webkit" /><!-- 浏览器高速模式 -->

	<meta name="keywords"
		content="信帧,teleframe,iparking,I停车,爱停车,blackshadowwalker" />
	<meta name="description"
		content="信帧,teleframe,iparking,I停车,爱停车,blackshadowwalker" />
	<meta name="author" content="blackshadowwalker" />

	<script type="text/javascript" src="scripts/jquery/jquery-1.7.min.js" ></script>	
	<script src="bootstrap/3.2/js/bootstrap.min.js"></script>
	<link href="bootstrap/3.2/css/bootstrap.css" rel="stylesheet" />

	
	<link href="plugins/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.min.css"rel="stylesheet" />
	<script type="text/javascript"src="plugins/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js"></script>
	<script type="text/javascript"src="plugins/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
	
	<link href="css/common.css" rel="stylesheet" />
	<script src="index/js/index.js" type="text/javascript"></script>
		
	<script src="scripts/waittool.js" type="text/javascript"></script>
	<script src="scripts/formattool.js" type="text/javascript"></script>
	
	<script src="scripts/jquery/tableSorter/scripts/JQueryPlugin/TableSort.js?" type="text/javascript"></script>
	<script src="modules/statistics/mypaystat/js/mypaystat.js" type="text/javascript" charset="utf-8" ></script>
	
	<script src="index/js/index.js" type="text/javascript"></script>
	
	
	<script type="text/javascript">
		var msg = "${msg}";
		if(msg!="")
			alert(msg);
	</script>

	<style>
		body {
			margin-left: 10px;
			margin-top: 7px;
			margin-right:10px;
			width:98%;
			font-size:9px;
			padding-right:10px;
			min-width:355px;
		}
		.form-group{
			width:220px;
		}
		.input-group-addon{
			width:75px;
		}
	</style>

</head>

<body>

	<div>
		<div class="alert-info notprint hidden">
			<div style="display:inline;margin-left:30px;color:#f00;">
				${msg}
			</div>
		</div>
	</div>
	
	<div class="hidden">
	</div>

	<div style="width:100%;" class="notprint">
	
		<form id="myform" name="myform" class="form-inline" role="form" action="${action }?method=query"  method="post">
		
				<!-- 条件查询 -->
				 <div class="form-group">
					 <div class="input-group">
						<div class="input-group-addon">收费员</div>
						<input class="form-control" type="text" placeholder="收费员姓名" style="width:150px" name="parkManager.realName" value="${parkManager.realName }" />
					</div>
				</div>
				<div class="form-group">
					<div class="input-group">
						<div class="input-group-addon">停车场</div>
						<select class="form-control" style="width: 150px" name="parkInfo.PId"> 
							<option value="">停车场选择----</option>
							<s:iterator value="listPark" id="park">
								<option value="${park.PId}" > ${park.PName} </option>
							</s:iterator>
							<script>
								$("select[name='parkInfo.PId']").val("${parkInfo.PId}");
							</script>
						</select>
					</div>	
				</div><!--  -->
				
				<div class="form-group">
					<div class="input-group form_datetime ">
						<input type="text" id="monthtime" class="btn datetime"  
							style="width:150px; border: 1px solid #ccc;border-top-right-radius: 0;border-bottom-right-radius: 0;"  
								size="7" name="datetime" value="${datetime }" readonly />
						<script>
							$("#myform input[name='datetime']").val("${datetime }");
						</script>
						<div class="input-group-addon form_datetime" >
							<i class="glyphicon glyphicon-th-large"></i>
						</div>
					</div>
				</div><!--  -->
				
					<input class="btn " type="submit" value="查询" />
					<input class="btn " type="button" value="重置" onclick="ResetForm()" />
					&nbsp;
					<button class="btn btn-primary btn-print glyphicon glyphicon-print notprint hidden-xs" title="打印"> </button>
					<button id="btn-export2Excel"  class="btn btn-success glyphicon glyphicon-download-alt notprint hidden-xs" title="导出Excel"/>
		</form>
	
	</div>
	
	<div id="data-table-div">	
			<center>
				<div class="print hidden" id="print-title"> <h2>绩效统计</h2> </div>
			</center>
			<table id="mytable" class="table  table-hover"  style="width:100%;">
				<thead>
					<tr role="head"> 
						<th sort="true" class="hidden" >序号</th>
						<th sort="true" >帐号</th>
						<th sort="true" >姓名</th>
						<th sort="true" >订单总数</th>
						<th sort="true" >应收入总额</th>
						<th sort="true" >实收总额</th>
						<th sort="true" >比例</th>
						<th class="notprint hidden">操作</th>
					</tr>
				</thead>
				<s:iterator value="listPF" status="index" id="l">
					<tr>
						<td class="hidden" ><s:property value="#index.index+1" /></td>
						<td><s:property value="#l.usercode" />
						</td>
						<td><s:property value="#l.username" />
						</td>
						<td><s:property value="#l.orderSum" />
						</td>
						<td><s:property value="#l.reAmount" />元
						</td>
						<td><s:property value="#l.acAmount" />元
						</td>
						<td><s:property value="#l.percent"/>%</td>
						<td class="notprint hidden">
							<span class="notprint">
								<s:if test="#request.view>0">
									<a class="" href="${action}?method=view&id=${id}">
										<span class="glyphicon glyphicon-list-alt" title="查看详情"></span>
									</a>
								</s:if>
							</span> 
						</td>
					</tr>
				</s:iterator>
			</table>
	</div>
	
	
	<div id="botter" class="botter">
		
		<br/>
		<br/>
		<br/>
		
	</div>
	
	
	<script>
	
		$("#myform input[type='submit']").click(
			function(e) {
				e.preventDefault();//阻止提交按钮的默认 action
				//check form 
				if( $("#monthtime").val()==""){
					alert("请选择时间");
					return ;
				}
				
				var btn = $(this);
				btn.val("正在提交...");
				btn.addClass("disabled");
				$(btn).parent().find("input[type='reset']").addClass("disabled");
				$("#myform").submit();
		});
		
		$(document).ready(function(){
				
				$("ul.nav-tabs li").click(function(){
					var tab = $(this);
					var nav = tab.parent();
					$(nav).children("li").each(function()
					{
						var obj = $(this);
						obj.removeClass("active");
					});
					tab.addClass("active");
				});
				
				var today = "<%=today%>";
		   		if( $("#monthtime").val()=="")
		   			$("#monthtime").val(today);
		   		$("#print-title").html( "<h2>"+ $("#monthtime").val()+" 绩效统计"+"</h2>" );
		   		
		   		$("#monthtime").datetimepicker({
		        	format: "yyyy-mm",
		        	language: "zh-CN",
		      	 	weekStart: 1,
		        	startView: 3, //日期时间选择器打开之后首先显示的视图。 Number, String. 默认值：2, 'month'
		        	todayBtn: true,
		        	autoclose: true,
		        	todayHighlight: true,
		        	minView:3 //日期时间选择器所能够提供的最精确的时间选择视图,Number, String. 默认值：0, 'hour'
		   		});
	   		
		   		//排序
		   		$("#mytable").sorttable({
		            ascImgUrl: "scripts/jquery/tableSorter/images/bullet_arrow_up.png",
		            descImgUrl: "scripts/jquery/tableSorter/images/bullet_arrow_down.png",
		            ascImgSize: "8px",
		            descImgSize: "8px",
		            onSorted: function (cell) {
// 		               alert(cell.index() + " -- " + $.trim(cell.text()));
		            }
		        });
		   		
		   		//print
				$("button.btn-print").click(function() {
					$(".notprint").hide();
					$("#errorFiled").hide();
					var td = $("td>.notprint").parent();
					td.hide();
					var titleObj = $("#data-table-div").find(".print&.hidden") ;
					titleObj.removeClass("hidden");
					titleObj.show();
					window.print();
					$(".notprint").show();
					titleObj.addClass("hidden");
					titleObj.hide();
					td.show();
					$("#errorFiled").show();
				});
				
				$("#btn-export2Excel").click(function export2Excel(e){
					e.preventDefault();//阻止提交按钮的默认 action
					var titleObj = $("#data-table-div").find(".print&.hidden h2") ;
				//	var html = $("#data-table-div").html();
					var url = "${action}?method=exportExcel&title="+titleObj.html();
					window.location.href = url ;;
					return;
				});
			   		
			});	
			
			function ResetForm(){
				$("#myform input[name='parkManager.realName']").val("");
				$("#myform select[name='parkInfo.PId']").val("");
			}
						
	</script>
	
		
</body>
</html>
